project(RoboCar)
cmake_minimum_required(VERSION 3.0)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
    set(TORCH_ROOT "E:/packages/libtorch-win-shared-with-deps-1.7.1+cu101/libtorch/share/cmake/Torch")
    set(BOOST_ROOT "F:/PCL 1.10.0/3rdParty/Boost")
    set(Boost_INCLUDE_DIR "F:/PCL 1.10.0/3rdParty/Boost/include/boost-1_72")
    #TODO:OpenCV的位置
    set(OpenCV_DIR E:/packages/opencv-4.5.1/build)
    set(PCL_DIR "F:/PCL 1.10.0/cmake")
    set(PCL_ROOT "F:/PCL 1.10.0")
    set(PYTHON_INCLUDE_DIR "D:/Python36/include")
    set(PYTHON_LIBRARY_DIR "D:/Python36/libs")
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
    set(OpenCV_DIR /opt/intel/openvino/opencv/cmake)
    set(TBB_ROOT /opt/intel/openvino_2020.2.120/deployment_tools/inference_engine/external/tbb)
endif ()
#TODO:启用64位编译
set(BUILD_USE_64BITS on)
message(STATUS "BUILD_USE_64BITS:${BUILD_USE_64BITS}")
#TODO:Boost编译组件版本
set(Boost_COMPILER vc142)
message(STATUS "Boost_COMPILER:${Boost_COMPILER}")

option(WITH_CONTROL_CENTER "Build Robot Control Center" ON)
set(BOOST_ROOT)
#TODO:是否编译TBB
option(WITH_TBB "Build With TBB" OFF)
#TODO:是否编译REALSENSE
option(WITH_LIBREALSENCE2 "Build With Librealsence" OFF)
#TODO:编译测试
option(RC_TEST "Build With test" ON)

#TODO:开启下位控制器模式
add_definitions(-D USE_DSP_DEVICE)

include(CheckCXXCompilerFlag)
set(CMAKE_CXX_STANDARD 14)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(OpenGL_GL_PREFERENCE GLVND)
set(BUILD_EXAMPLES OFF)

set(ENV_CMAKE_FILES_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_FILES_PATH ${PROJECT_SOURCE_DIR}/src/cmake)
#include(${ENV_CMAKE_FILES_PATH}/rcMpiCmake.cmake)
#include(${ENV_CMAKE_FILES_PATH}/rcBoostCmake.cmake)

#add_subdirectory(3rdparty/grpc)
#add_subdirectory(3rdparty/gflags)
add_subdirectory(3rdparty/libserv)
if (${WITH_TBB} STREQUAL "OFF")
    add_subdirectory(3rdparty/librealsense)
endif ()
add_subdirectory(3rdparty/websocketpp)


add_subdirectory(tools)
add_subdirectory(robot_client)

if (${WITH_CONTROL_CENTER} STREQUAL "OFF")
    add_subdirectory(robot_center)
endif ()

